import { createMemoryHistory, createWebHashHistory, createRouter } from 'vue-router'

import IndexView from '../views/Index.vue'
import Login from '../components/user/Login.vue'
import Register from '../components/user/Register.vue'
import ForgetPwd from '../components/user/Forgetpwd.vue'
import DetailHome from '../views/Detail/DetailHome.vue'
import Doctor from "../views/Doctor/Doctor.vue"
import DoctorInfo from "../views/Doctor/DoctorInfo.vue";


const routes = [
    {
        meta:{
            title: "丁香医院-首页",
            keepAlive: true
        },
        path: '/',
        // path: '/111',
        component: IndexView,
        redirect: '/home',
        children: [
            { path: '/home', component: ()=> import("../views/Home.vue")}
        ]
    },
    {
        meta:{
            title: "丁香医院-健康百科详情页",
            keepAlive: true
        },
        // path: '/detail_home',
        path: '/detail',
        component: DetailHome,
        redirect: '/health_detail',
        children: [
            { path: '/health_detail', component: ()=> import("../views/Detail/HealthDetail.vue")},
            { path: '/health_info', component: ()=> import("../views/Detail/HealthInfo.vue")},
            { path: '/hospital_list', component: ()=> import("../views/Hospital/Hospital.vue")},
            { path: '/hospital_info', component: ()=> import("../views/Hospital/HospitalInfo.vue")},
        ]
    },
    {
        meta:{
            title: "丁香医院-登录界面",
            keepAlive: true
        },
        path: '/login',
        component: Login
    },
    {
        meta:{
            title: "丁香医院-注册界面",
            keepAlive: true
        },
        path: '/register',
        component: Register
    },
    {
        meta:{
            title: "丁香医院-忘记密码",
            keepAlive: true
        },
        path: '/forgetPwd',
        component: ForgetPwd
    },
    {
        meta:{
            title: "丁香医院-医生问诊",
            keepAlive: true
        },
        // path: '/',
        path: '/doctor',
        component: Doctor
    },
    {
        meta:{
            title: "丁香医院-医生详情",
            keepAlive: true
        },
        path: '/doctorInfo',
        component: DoctorInfo
    },
    {
        meta:{
            title: "丁香医院-提问界面",
            keepAlive: true
        },
        path: '/question',
        // path: '/',
        component: () => import("../views/Doctor/Questions.vue"),
    },
    {
        meta:{
            title: "丁香医院-患者信息界面",
            keepAlive: true
        },
        path: '/patient',
        // path: '/',
        component: () => import("../views/Doctor/Patients.vue"),
    },
    {
        meta:{
            title: "丁香医院-患者信息编辑界面",
            keepAlive: true
        },
        path: '/patients_edit',
        // path: '/',
        component: () => import("../views/Doctor/PatientsEdit.vue"),
    },
    {
        meta:{
            title: "丁香医院-支付界面",
            keepAlive: true
        },
        path: '/pay',
        // path: '/',
        component: () => import("../views/Pay/Pay.vue"),
    },
    {
        meta:{
            title: "丁香医院-优惠劵界面",
            keepAlive: true
        },
        path: '/coupon',
        // path: '/',
        component: () => import("../views/Pay/Coupon.vue"),
    },
    {
        meta:{
            title: "丁香医院-我的问诊界面",
            keepAlive: true
        },
        path: '/order',
        // path: '/',
        component: () => import("../views/Pay/Order.vue"),
    },
    {
        meta:{
            title: "丁香医院-支付成功界面",
            keepAlive: true
        },
        path: '/paySuccess',
        // path: '/',
        component: () => import("../views/Pay/PaySuccess.vue"),
    },
    {
        meta:{
            title: "丁香医院-问答回复界面",
            keepAlive: true
        },
        path: '/answer',
        // path: '/',
        component: () => import("../views/Answer/Answer.vue"),
    },
    {
        meta:{
            title: "丁香医院-科室分类界面",
            keepAlive: true
        },
        path: '/department',
        // path: '/',
        component: () => import("../views/Department/Department.vue"),
    },
    {
        meta:{
            title: "丁香医院-医生列表界面",
            keepAlive: true
        },
        path: '/doctorList',
        // path: '/',
        component: () => import("../views/Doctor/DoctorList.vue"),
    },
    {
        meta:{
            title: "丁香医院-AI问答界面",
            keepAlive: true
        },
        path: '/ai_question',
        // path: '/',
        component: () => import("../views/Question.vue"),
    },
]

const router = createRouter({
    // history: createMemoryHistory(),
    history: createWebHashHistory(),
    routes,
    scrollBehavior (to, from, savedPosition) {
        return { top: 0 };
    }
})

export default router